<template>
    <a-input size="small" :disabled="readonly" v-model:value="InputValue">
        <template #suffix>
            {{ Option.Unit }}
        </template>
    </a-input>
</template>
<script setup>
import { ref, watch } from 'vue';

const emit = defineEmits(['update:modelValue'])
const props = defineProps({
    Option: Object,
    modelValue: String,
});

const readonly = ref(false);
const InputValue = ref();

watch(() => props.Option.readonly, val => {
    readonly.value = !!val
})

watch(() => props.modelValue, val => {
    InputValue.value = val;
}, { immediate: true });

watch(InputValue, (val) => {
    emit('update:modelValue', val);
})

</script>
<style lang="less" scoped>

</style>